package com.yjd.comm.user.model;

import java.util.Map;

import com.yjd.comm.base.model.Model;
import com.yjd.comm.user.util.UserUtil;
import com.yjd.comm.util.DateUtil;
import com.yjd.comm.util.MobileUtil;
import com.yjd.comm.util.StringUtil;

/**
 * <b>description</b>：系统菜单模型<br>
 * <b>time</b>：2014-11-05 11:45:03 <br>
 * <b>author</b>： renbangjie_vip@163.com
 */
public class UserModel extends Model {

	/**
	 * @Fields serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 会员id
	 */
	private Long user_id;
	/**
	 * 用户名
	 */
	private String username;
	/**
	 * 邮箱
	 */
	private String email;
	/**
	 * 手机号码
	 */
	private Long mobile;
	/**
	 * 密码加密盐
	 */
	private String encrypt;
	/**
	 * 密码
	 */
	private String password;
	/**
	 * 支付密码
	 */
	private String paypassword;
	/**
	 * 注册日期
	 */
	private Long regdate;
	/**
	 * 最后登入日期
	 */
	private Long lastdate;
	/**
	 * 注册IP
	 */
	private String regip;
	/**
	 * 最后登入IP
	 */
	private String lastip;
	/**
	 * 登入次数
	 */
	private Integer loginnum;
	/**
	 * 是否锁定
	 */
	private Integer islock;

	// 是否邀请推广用户
	private Boolean is_prommotion_user;
	
	// 是否代发工资
	private Boolean is_user_card;

	private String regdateShow;

	/**
	 * 处理后的手机号
	 */
	private String mobileStr;

	/**
	 * 处理后的证件号
	 */
	private String idCardStr;
	
	/**
	 * 用户类型
	 */
	private Integer user_type;
	
	/**
	 * 注册渠道
	 */
	private Integer channel;
	
	private String expand;  //注册来源

	/**
	 * 头像
	 */
	private String img_name;
	

	public UserModel() {

	}

	public Boolean getIs_user_card() {
		return is_user_card;
	}

	public void setIs_user_card(Boolean is_user_card) {
		this.is_user_card = is_user_card;
	}

	public UserModel(Long user_id, String username, String email, Long mobile,
			String encrypt, String password, String paypassword, Long regdate,
			Long lastdate, String regip, String lastip, Integer loginnum,
			Integer islock, Boolean is_prommotion_user, Boolean is_user_card) {
		this.user_id = user_id;
		this.username = username;
		this.email = email;
		this.mobile = mobile;
		this.encrypt = encrypt;
		this.password = password;
		this.paypassword = paypassword;
		this.regdate = regdate;
		this.lastdate = lastdate;
		this.regip = regip;
		this.lastip = lastip;
		this.loginnum = loginnum;
		this.islock = islock;
		this.is_prommotion_user = is_prommotion_user;
		this.is_user_card = is_user_card;
	}

	public Boolean getIs_prommotion_user() {
		return is_prommotion_user;
	}

	public void setIs_prommotion_user(Boolean is_prommotion_user) {
		this.is_prommotion_user = is_prommotion_user;
	}

	public String getRegdateShow() {
		return regdateShow;
	}

	public void setRegdateShow(String regdateShow) {
		this.regdateShow = regdateShow;
	}

	public Long getUser_id() {
		return user_id;
	}

	public void setUser_id(Long user_id) {
		this.user_id = user_id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Long getMobile() {
		return mobile;
	}

	public void setMobile(Long mobile) {
		this.mobile = mobile;
	}

	public String getEncrypt() {
		return encrypt;
	}

	public void setEncrypt(String encrypt) {
		this.encrypt = encrypt;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPaypassword() {
		return paypassword;
	}

	public void setPaypassword(String paypassword) {
		this.paypassword = paypassword;
	}

	public Long getRegdate() {
		return regdate;
	}

	public void setRegdate(Long regdate) {
		this.regdate = regdate;
	}

	public Long getLastdate() {
		return lastdate;
	}

	public void setLastdate(Long lastdate) {
		this.lastdate = lastdate;
	}

	public String getRegip() {
		return regip;
	}

	public void setRegip(String regip) {
		this.regip = regip;
	}

	public String getLastip() {
		return lastip;
	}

	public void setLastip(String lastip) {
		this.lastip = lastip;
	}

	public Integer getLoginnum() {
		return loginnum;
	}

	public void setLoginnum(Integer loginnum) {
		this.loginnum = loginnum;
	}

	public Integer getIslock() {
		return islock;
	}

	public void setIslock(Integer islock) {
		this.islock = islock;
	}

	public String getMobileStr() {
		return mobileStr;
	}

	public void setMobileStr(String mobileStr) {
		this.mobileStr = mobileStr;
	}

	public String getIdCardStr() {
		return idCardStr;
	}

	public void setIdCardStr(String idCardStr) {
		this.idCardStr = idCardStr;
	}
	
	public Integer getUser_type() {
		return user_type;
	}

	public void setUser_type(Integer user_type) {
		this.user_type = user_type;
	}

	public Integer getChannel() {
		return channel;
	}

	public void setChannel(Integer channel) {
		this.channel = channel;
	}
	
	public String getExpand() {
		return expand;
	}

	public void setExpand(String expand) {
		this.expand = expand;
	}
	public String getImg_name() {
		return img_name;
	}

	public void setImg_name(String img_name) {
		this.img_name = img_name;
	}

	public void setParamsByMapForDto(Map<String, Object> m) {
		this.user_id = new Long((Integer) m.get("user_id"));
		this.username = (String) m.get("username");
		this.email = (String) m.get("email");
		this.mobile = (Long) m.get("mobile");
		this.regdate = (Long) m.get("regdate");
		this.lastdate = (Long) m.get("lastdate");
		this.user_type = (Integer) m.get("user_type");
		this.encrypt = "";
		this.password = "";
		this.paypassword = "";
		this.regip = "";
		this.lastip = "";
		this.islock = 0;
	}

	public void setStrMap() throws Exception {
		this.setMobileStr(UserUtil.disposeMobile(this.mobile + ""));
		this.getStrMap().put(
				"regdate",
				DateUtil.timestampToDateString(this.getRegdate(),
						DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
		this.getStrMap().put(
				"lastdate",
				DateUtil.timestampToDateString(this.getLastdate(),
						DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
		this.getStrMap().put(
				"password",
				StringUtil.isNotEmpty(this.getPassword()) ? "已设置"
						: "<font color=\"red\">未设置</font>");
		this.getStrMap().put(
				"paypassword",
				StringUtil.isNotEmpty(this.getPaypassword()) ? "已设置"
						: "<font color=\"red\">未设置</font>");
		this.getStrMap().put(
				"islock",
				this.getIslock() == 0 ? "<font color=\"green\">未锁定</font>"
						: "<font color=\"red\">锁定账户</font>");
		this.getStrMap().put(
				"lastdate",
				DateUtil.timestampToDateString(this.getLastdate(),
						DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
		this.getStrMap().put("mobile",
				this.mobile + " " + MobileUtil.getMobileData(this.mobile + ""));
	}

}
